# Maintainer: Morten Linderud <foxboron@arhlinux.org>
# Contributor: Sébastien "Seblu" Luttringer <seblu@arhlinux.org>

pkgname=go-md2man
pkgver=2.0.3
pkgrel=1
pkgdesc='A markdown to manpage generator'
arch=('loong64' 'x86_64')
url='https://github.com/cpuguy83/go-md2man'
license=('MIT')
makedepends=('go')
source=($pkgname-$pkgver.tar.gz::"https://github.com/cpuguy83/go-md2man/archive/v$pkgver.tar.gz")
sha256sums=('7ca3a04bb4ab83387538235decc42a535097a05d2fb9f2266d0c47b33119501f')

build() {
  cd "$pkgname-$pkgver"
  export GOFLAGS="-mod=vendor -trimpath"
  export CGO_LDFLAGS="$LDFLAGS"
  export GOPROXY=https://goproxy.cn
  go build -o go-md2man .
  ./go-md2man -in=go-md2man.1.md -out=go-md2man.1
}

package() {
  cd "$pkgname-$pkgver"
  install -Dm755 go-md2man "$pkgdir/usr/bin/go-md2man"
  install -Dm755 go-md2man.1 "$pkgdir/usr/share/man/man1/go-md2man.1"
  install -Dm755 LICENSE.md "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
